<template>
  <view class="page">
    <t-cropper mode="free" :imageUrl="imageUrl" :width="500" :height="500" :delay="150" @cancel="onCancel"
      @confirm="onConfirm" :primaryColor="themePrimary"></t-cropper>
  </view>

</template>
<script setup>
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import TCropper from '@/uni_modules/t-cropper/components/t-cropper/t-cropper.vue';
import { useTheme } from '@/composables/useTheme';
const { themePrimary } = useTheme();
const imageUrl = ref('');

onLoad((options) => {
  imageUrl.value = options.url;
});

const onCancel = () => {
  uni.navigateBack();
};

const onConfirm = (data) => {
  console.log('cropper', data);
  uni.redirectTo({
    url: `/pages/common/camera/preview?url=${data.tempFilePath}`
  });
};
</script>